namespace Behaving.Composites
{
    // Traverses its child nodes in order, left to right. The Selector succeeds as soon as any child succeeds. 
    // The Selector fails only if all children fail. Like Sequence, Selector retains a "running" child and
    // traverses it first on the next tick.               
    public class Selector : CompositeExtended
    {
        public Selector(params Behaviour[] children)
            : base(children)
        {
        }

        protected override RunningState AfterSequenceState { get { return RunningState.Failure; } }

        protected override bool SequenceDone(RunningState runningState)
        {
            return runningState == RunningState.Success;
        }
    }
}